package main

import (
	"fmt"
	"snowFlake"
)

func main() {
	w := snowFlake.NewWorker(-1, 11, 12, 2687)
	i := 0
	r := make([]int64, 0)
	for {
		id := w.NextId()
		r = append(r, id)
		i++
		if i > 10000000 {
			break
		}
	}
	j := 0
	for _, v := range r {
		if v > 1 {
		}
		j++
	}
	fmt.Println(j)
	fmt.Println(len(unique(r)))
	fmt.Println(w)
}
func unique(m []int64) []int64 {
	s := make([]int64, 0)
	smap := make(map[int64]int64)
	for _, value := range m {
		//计算map长度
		length := len(smap)
		smap[value] = 1
		//比较map长度, 如果map长度不相等， 说明key不存在
		if len(smap) != length {
			s = append(s, value)
		}
	}

	return s

}
